<template>
  <view class="content">
    <view class="upload-item" v-for="(item, index) in allimg" :key="index" @click="type!='5'?previewImage(item,1):''">
        <view class="image-wrapper"><img class="img-all" :src="item" mode="aspectFit"/></view>
    </view>
    <!-- 全局通用组件 -->
    <law-common ref="lawCommon"></law-common>
  </view>
</template>
<script>
export default {
  data() {
    return {
      url: '',
      allimg:[],
      type:""
    };
  },
  created() {},
  onLoad(params) {
    if (params.url) {
      this.url = params.url;
      this.allimg = params.url.split(',');
      console.log("3333333333",this.url);
    }
    if(params.type == 1){
      uni.setNavigationBarTitle({
        title: '债权投资合同'
      })
    }
    if(params.type == 2){
      uni.setNavigationBarTitle({
        title: '服务阶段'
      })
    }
    if(params.type == 3){
      uni.setNavigationBarTitle({
        title: '审理地点'
      })
    }
    if(params.type == 4){
      uni.setNavigationBarTitle({
        title: '投资人承担'
      })
    }
    if(params.type == 5){
      uni.setNavigationBarTitle({
        title: '第三方费用'
      })
      this.type = params.type;
    }
    console.log("----5555555",this.allimg);
  },
  methods: {
    previewImage() {
      // 是图片,预览
      let previewImages =  this.allimg;
      console.log("----item,type",previewImages);
      //   // 预览图片
      const nav = navigator.userAgent;
      if (nav.indexOf('Android') > -1 || nav.indexOf('Adr') > -1) {
        phone.previewPicture(JSON.stringify(previewImages));
      } else if (!!nav.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/)) {
        this.$bridge.callhandler('previewPicture', previewImages, data => {});
      }

    }
  }
};
</script>

<style lang="scss">
page{
  width: 100%;
  height: 100%;
  overflow-y: scroll;
}
.content,.upload-item,.image-wrapper{
  width: 100%;
}
.img-all{
  width: 100%;
}
</style>
